package com.levi.common;

import lombok.Data;

/**
 * @author shentong
 * @since 2022/3/11 8:34 PM
 */
@Data
public class AjaxResult {

	public static final String CODE_TAG = "code";

	public Integer code;

	public Object data;

	public static AjaxResult ok() {
		AjaxResult ajaxResult = new AjaxResult();
		ajaxResult.setCode(200);
		return ajaxResult;
	}

	public static AjaxResult ok(Object data) {
		AjaxResult ajaxResult = new AjaxResult();
		ajaxResult.setCode(200);
		ajaxResult.setData(data);
		return ajaxResult;
	}

	public static AjaxResult error(Object data) {
		AjaxResult ajaxResult = new AjaxResult();
		ajaxResult.setCode(500);
		ajaxResult.setData(data);
		return ajaxResult;
	}

	public Integer get(String codeTag) {
		return this.code;
	}

}
